<template>
	<view>
		<u-navbar :back-text-style="{color: '#fff'}" title-color="#fff" back-icon-color="#ffffff"
			back-icon-name="arrow-leftward" title="禾积分流水" :background="NavBackgroud"></u-navbar>
		<view class="padding">
			<view class="flex solid radios line-green padding margin" v-for="(item,index) in tokenBill" :key="index">		
				<view class="flex-sub flex align-center  text-green text-bold">
					<text class="text-green text-bold">LHT</text>
				</view>
				<view class="flex-treble">
					<view class="align-left flex">
						<view class="flex-sub text-left" :class="item.pm==1?'text-green':'text-red'">{{item.pm==1?'+':'-'}}{{item.tokenNumber}}
						</view>
						<view class="flex-sub text-right" :class="item.pm==1?'text-green':'text-red'">{{item.title}}</view>						
					</view>
					<view class="align-end flex">
						<view class="text-grey flex-sub text-left">{{item.tokenBalance}}</view>
						<view class="text-grey flex-sub text-right">{{item.updateTime.slice(5,21)}}</view>
					</view>
				</view>
			</view>
		</view>

	</view>
</template>

<script>
	import axbCheckBox from '@/components/axb-checkbox/axb-checkbox.vue'
	import uinput from "@/components/poiuy-uinput/uinput.vue"

	import {
		getUserInfo,
		userActivity,
		getuserDalance,
		getIntegralList
	} from '@/api/user.js';

	import {
		mapGetters
	} from "vuex";

	import {
		toLogin
	} from '@/libs/login.js';

	import {
		chartIncrementTrendApi,
		currentTokenPrice
	} from '@/api/admin.js';

	let _self;

	export default {
		components: {
			axbCheckBox,
			uinput
		},
		computed: mapGetters(['isLogin']),
		data() {
			return {
				pwidth: 400,
				tokenBill: null
			}
		},
		onLoad() {
			let _this = this
			uni.getSystemInfo({
				success: function(res) {
					_this.pwidth = res.windowWidth - 20
				}
			});
			console.log(this.pwidth)


			if (this.isLogin) {
				this.getTokenBill();
			} else {
				// #ifdef H5 || APP-PLUS
				toLogin();
				// #endif 				
			}
		},
		methods: {
			getTokenBill() {
				getIntegralList({
					page: 1,
					limit: 10
				}).then(res => {
					console.log(res.data)
					this.tokenBill = res.data.list
				})
			}
		}
	}
</script>
